import { defHttp } from '/@/utils/http/axios';
import { ContentTypeEnum } from '/@/enums/httpEnum';

enum Api {
  deptList = '/admin-api/system/dept/list',
  deptsimple = '/admin-api/system/dept/list-all-simple',
  roleList = '/admin-api/system/role/list-all-simple',
  createdept = '/admin-api/system/dept/create',
  getdept = '/admin-api/system/dept/get',
  updatedept = '/admin-api/system/dept/update',
  deletedept = '/admin-api/system/dept/delete',
}

/**
 * @description: 部门
 */
export const getDeptList = (params: any) => {
  return defHttp.get<any>({ url: Api.deptList, params });
};
export const getDeptsimple = (params: any) => {
  return defHttp.get<any>({ url: Api.deptsimple, params });
};
export const createDept = (params: any) => {
  return defHttp.post<any>({ url: Api.createdept, params });
};

export const getDept = (params: any) => {
  return defHttp.get<any>({ url: Api.getdept, params });
};
export const updateDept = (params: any) => {
  return defHttp.put<any>({ url: Api.updatedept, params });
};
export const deleteDept = (params: any) => {
  return defHttp.delete<any>(
    { url: Api.deletedept, params, headers: { 'Content-Type': ContentTypeEnum.FORM_URLENCODED } },
    { joinParamsToUrl: true },
  );
};
